﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

public partial class admin_delBlogroll : System.Web.UI.Page
{
    db_blogroll blogroll = new db_blogroll();
    protected void Page_Load(object sender, EventArgs e)
    {
        Server.Execute("inc/checkPurview.aspx");  // 此处用户权限验证

        string blogroll_ID = Request.QueryString["id"];
        //通过验证控件的验证
        if (blogroll_ID != null)
        {

            // Response.Write("<script language=javascript>alert('！！！！\\n" + isPic + "');location.href='manageExpress.aspx';</script>");
            string serverLogo=blogroll.selectBlogrollONE(blogroll_ID).Tables[0].Rows[0]["siteLogo"].ToString();
            if (blogroll.delBlogroll(blogroll_ID))
            {
                string path = Server.MapPath(serverLogo);
                if(File.Exists(path))
                {
                    File.Delete(path);
                }
                Response.Write("<script language=javascript>alert('删除成功！');location.href='manageBlogroll.aspx';</script>");
            }
            else
            {
                Response.Write("<script language=javascript>alert('删除失败！');location.href='manageBlogroll.aspx';</script>");
            }

        }
        else
        {
            Response.Redirect("manageBlogroll.aspx");
        }

    }
}